<!DOCTYPE html>
<html lang="en">
<head>
    <!--
    @Author 硕鼠
    @Date 2020/4/6 9:20
    @Version 1.0
    @Description 初始函数
  -->
    <meta charset="UTF-8">
    <title>JS文件学习1</title>
    <script>
        function toGreen() {
            //变量
            var oDiv = document.getElementById('div1');
            oDiv.style.width = '200px';
            oDiv.style.width = '200px';
            oDiv.style.background = 'green';
        }
        function toRed() {
            var oDiv = document.getElementById('div1');
            oDiv.style.width = '300px';
            oDiv.style.width = '300px';
            oDiv.style.background = 'red';
        }

    </script>
</head>
<body>
<div id="div1" onmouseover="toGreen()" onmouseout="toRed()">
    你好。。。
</div>
</body>
</html>